﻿using System;
using System.ComponentModel;
using System.Configuration;

namespace mki.Backup.Objects
{
	/// <summary>
	/// FPT Action Block
	/// </summary>
	public class FTPJobElement : CustomConfigurationElement
	{
		#region Properties (5)

		/// <summary>
		/// Gets or sets the FTP host.
		/// </summary>
		/// <value>
		/// The FTP host.
		/// </value>
		[ConfigurationProperty("ftpHost", IsRequired = true)]
		[Description("Host for FTP Connection"), Category("Design")]
		public String FTPHost
		{
			get { return this["ftpHost"].ToString(); }
			set { this["ftpHost"] = value; }
		}

		/// <summary>
		/// Gets the delete file collection.
		/// </summary>
		[ConfigurationProperty("addFiles", IsDefaultCollection = false)]
		[ConfigurationCollection(typeof(FTPAddSection), AddItemName = "addFile")]
		[Browsable(false)]
		public FTPAddSection AddFileCollection
		{
			get { return base["addFiles"] as FTPAddSection; }
		}

		/// <summary>
		/// Gets the upload file collection.
		/// </summary>
		[ConfigurationProperty("deleteFiles", IsDefaultCollection = false)]
		[ConfigurationCollection(typeof(FTPDeleteSection), AddItemName = "deleteFile")]
		[Browsable(false)]
		public FTPDeleteSection DeleteFileCollection
		{
			get { return base["deleteFiles"] as FTPDeleteSection; }
		}

		/// <summary>
		/// Gets or sets the name.
		/// </summary>
		/// <value>
		/// The name.
		/// </value>
		[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
		[Description("Name of this FTP Job"), Category("Design")]
		public new String Name
		{
			get { return base["name"].ToString(); }
			set
			{
				base["name"] = value;
				base.OnPropertyChanged("Name");
			}
		}

		/// <summary>
		/// Gets or sets the password.
		/// </summary>
		/// <value>
		/// The password.
		/// </value>
		[ConfigurationProperty("password", IsRequired = false)]
		[Description("Password for FTP connection"), Category("Design")]
		public String Password
		{
			get { return this["password"].ToString(); }
			set { this["password"] = value; }
		}

		/// <summary>
		/// Gets or sets the root folder.
		/// </summary>
		/// <value>
		/// The root folder.
		/// </value>
		[ConfigurationProperty("rootFolder", IsRequired = true)]
		[Description("Folder on FTP host. Use forward slash for path. Do not start with a slash"), Category("Design")]
		public String RootFolder
		{
			get { return this["rootFolder"].ToString(); }
			set { this["rootFolder"] = value; }
		}

		/// <summary>
		/// Gets or sets the name of the user.
		/// </summary>
		/// <value>
		/// The name of the user.
		/// </value>
		[ConfigurationProperty("userName", IsRequired = false)]
		[Description("Username for FTP connection"), Category("Design")]
		public String UserName
		{
			get { return (String)this["userName"]; }
			set { this["userName"] = value; }
		}

		#endregion Properties
	}
}